# Maintainer:
# Contributor: Dale Blount <dale@archlinux.org>
# Contributor: Manolis Tzanidakis

pkgname=razor
pkgver=2.85
pkgrel=18
pkgdesc="A distributed, collaborative, spam detection and filtering network"
arch=('x86_64')
url="http://razor.sourceforge.net"
license=('PerlArtistic')
depends=('perl-net-dns' 'perl-digest-sha1' 'perl-uri' 'perl-digest-nilsimsa' 'perl')
options=('!emptydirs')
source=("https://downloads.sourceforge.net/${pkgname}/${pkgname}-agents-${pkgver}.tar.bz2"
         razor-2.85-cosmetic-pv-fix.patch
         razor-2.85-makefile-quoting-fix.patch)
sha256sums=('7fe0afe73e5b3979444dd86e2ad25ea99bc05b23d5648d357544f78f0b6eb6d7'
            '9b9e40a6ce0220bb2228dd7807a14ecd7febe5290ace74744eea90ab9ab13aa5'
            'd6ad13978170ad5914383db43376a89f38c03a17db1780d1e0df6f9c9ececd07')

prepare() {
  cd ${pkgname}-agents-${pkgver}

  patch -p1 -i ../razor-2.85-cosmetic-pv-fix.patch

  # ExtUtils::MakeMaker >= 6.99_09 has quotes around paths
  patch -p1 -i ../razor-2.85-makefile-quoting-fix.patch
}

build() {
  cd ${pkgname}-agents-${pkgver}
  perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd ${pkgname}-agents-${pkgver}
  make test
}

package() {
  cd ${pkgname}-agents-${pkgver}
  make DESTDIR="${pkgdir}" install
}
